package com.mysoft.gfyx.workbench.subscriber;

import com.fasterxml.jackson.core.type.TypeReference;
import com.mysoft.framework.common.util.JsonUtil;
import com.mysoft.framework.event.annotation.Subscriber;
import com.mysoft.framework.event.api.EventSubscriber;
import com.mysoft.framework.event.enums.EventResultEnum;
import com.mysoft.framework.event.info.EventArgument;
import com.mysoft.framework.event.info.Result;
import com.mysoft.gfyx.workbench.subscriber.dto.BusinessUnitDto;
import com.mysoft.gfyx.workbench.subscriber.dto.UserWrapperDto;
import lombok.extern.slf4j.Slf4j;

import javax.management.remote.NotificationResult;

@Slf4j
@Subscriber(name = "Java-sdk 组织变更同步到新底座")
public class BusinessUnitChangeAfterEventSubscriber extends EventSubscriber<BusinessUnitDto, NotificationResult> {
    @Override
    public Result<NotificationResult> subscribe(BusinessUnitDto message) {
        System.out.printf("用户组织同步事件变更:%s\n", JsonUtil.toString(message));
        return new Result(EventResultEnum.SUCCESS);
    }

    @Override
    public TypeReference<EventArgument<BusinessUnitDto, NotificationResult>> getMessageType() {
        return new TypeReference<EventArgument<BusinessUnitDto, NotificationResult>>() {
        };
    }
}
